﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lola.DTO;

namespace Lola.Datos.Persistencia
{
    /// <summary>
    /// Gestor de persistencia para los sectores
    /// </summary>
    public static class pSector
    {
        /// <summary>
        /// Obtiene todos los sectores del sistema
        /// </summary>
        /// <returns></returns>
        public static List<dtoSector> getSectores()
        {
            List<dtoSector> res = new List<dtoSector>();

            using (SeminarioIEntities contexto = new SeminarioIEntities())
            {
                var query = from sec in contexto.Sectors select sec;
                foreach (Sector s in query)
                {
                    dtoSector ns = new dtoSector(s.nomSec, s.numSec);
                    res.Add(ns);
                }
            }

            return res;
        }
    }
}
